package com.ruoyi.iot.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.iot.mapper.IotCategoryMapper;
import com.ruoyi.iot.domain.IotCategory;
import com.ruoyi.iot.service.IIotCategoryService;

/**
 * 产品分类Service业务层处理
 * 
 * @author cjc
 * @date 2025-02-08
 */
@Service
public class IotCategoryServiceImpl implements IIotCategoryService 
{
    @Autowired
    private IotCategoryMapper iotCategoryMapper;

    /**
     * 查询产品分类
     * 
     * @param categoryId 产品分类主键
     * @return 产品分类
     */
    @Override
    public IotCategory selectIotCategoryByCategoryId(Long categoryId)
    {
        return iotCategoryMapper.selectIotCategoryByCategoryId(categoryId);
    }

    /**
     * 查询产品分类列表
     * 
     * @param iotCategory 产品分类
     * @return 产品分类
     */
    @Override
    public List<IotCategory> selectIotCategoryList(IotCategory iotCategory)
    {
        return iotCategoryMapper.selectIotCategoryList(iotCategory);
    }

    /**
     * 新增产品分类
     * 
     * @param iotCategory 产品分类
     * @return 结果
     */
    @Override
    public int insertIotCategory(IotCategory iotCategory)
    {
        iotCategory.setCreateTime(DateUtils.getNowDate());
        return iotCategoryMapper.insertIotCategory(iotCategory);
    }

    /**
     * 修改产品分类
     * 
     * @param iotCategory 产品分类
     * @return 结果
     */
    @Override
    public int updateIotCategory(IotCategory iotCategory)
    {
        iotCategory.setUpdateTime(DateUtils.getNowDate());
        return iotCategoryMapper.updateIotCategory(iotCategory);
    }

    /**
     * 批量删除产品分类
     * 
     * @param categoryIds 需要删除的产品分类主键
     * @return 结果
     */
    @Override
    public int deleteIotCategoryByCategoryIds(Long[] categoryIds)
    {
        return iotCategoryMapper.deleteIotCategoryByCategoryIds(categoryIds);
    }

    /**
     * 删除产品分类信息
     * 
     * @param categoryId 产品分类主键
     * @return 结果
     */
    @Override
    public int deleteIotCategoryByCategoryId(Long categoryId)
    {
        return iotCategoryMapper.deleteIotCategoryByCategoryId(categoryId);
    }
}
